package com.Ajou.Talky2;




public class MmsPDUParsor {

	String test = "";

	MmsPDU pdu_;




	public MmsPDUParsor() {
		super();

		MmsPDU pdu_ = new MmsPDU();
	}




	public void Parsor(String input)
	{
		input = "X-Mms-Read-Report: Yes";

		String splited_text[] = input.split(": ");
		System.out.println(splited_text[0]);


		try {
			if (input == "X-Mms-Content-Location") {
				// TODO
			} else if (input == "Content-Type") {
				pdu_.setMessageContentType(splited_text[1]);
			} else if (input == "Date") {
				//pdu_.setMessageDate(d);
			} else if (input == "X-Mms-Delivery-Report") {
				if (splited_text[1] == pdu_.YES)
					pdu_.setDeliveryReport(true);
				else if (splited_text[1] == pdu_.NO)
					pdu_.setDeliveryReport(false);
				else {
					// No action	
				}
			} else if (input == "X-Mms-Delivery-Time") {
				// TODO
				//pdu_.setMessageDeliveryTime(time, absolute);
			} else if (input == "X-Mms-Expiry") {
				//pdu_.setMessageExpiryTime(time, absolute);
			} else if (input == "From") {
				//pdu_.addMessageReceiver(receiver, addressType);
			} else if (input == "X-Mms-Message-Class") {
				pdu_.setMessageClass(splited_text[1]);
			} else if (input == "Message-ID") {
				pdu_.setMessageID(splited_text[1]);
			} else if (input == "X-Mms-Message-Type") {
				pdu_.setMessageType(splited_text[1]);
			} else if (input == "X-Mms-MMS-Version") {
				pdu_.setVersion(splited_text[1]);
			} else if (input == "X-Mms-Message-Size") {
				// no setter
			} else if (input == "X-Mms-Priority") {
				pdu_.setMessagePriority(splited_text[1]);
			} else if (input == "X-Mms-Read-Report") {
				if (splited_text[1] == pdu_.YES)
					pdu_.setReadReport(true);
				else if (splited_text[1] == pdu_.NO)
					pdu_.setReadReport(false);
				else {
					// No action	
				}
			} else if (input == "X-Mms-Report-Allowed") {
				// no setter
			} else if (input == "X-Mms-Response-Status") {
				pdu_.setResponseStatus(splited_text[1]);
			} else if (input == "X-Mms-Response-Text") {
				pdu_.setResponseText(splited_text[1]);
			} else if (input == "X-Mms-Status") {
				pdu_.setMessageStatus(splited_text[1]);
			} else if (input == "Subject") {
				pdu_.setMessageSubject(splited_text[1]);
			} else if (input == "To") {
				//pdu_.setMessageSender(sender, addressType);
			} else if (input == "X-Mms-Transaction-Id") {
				pdu_.setTransactionID(splited_text[1]);
			} else if (input == "X-Mms-Retrieve-Status") {
				// no setter
			} else if (input == "X-Mms-Stored") {
				// no setter
			} else {
				//TODO
			}
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}
